﻿@using System.Web.Optimization;
@using Smarly.Bussines.Membership
@using Smarly.Bussines.Model

@model Smarly.Bussines.Model.BookTree

@{
/*
	bool isAdmin = User.IsInRole("Admin");
	bool isAllowEdit = ((SmarlyPrincipal) User).AllowChanges(Model.Url);
	bool isViewer = isAdmin || isAllowEdit || (User.Identity.IsAuthenticated && User.IsInRole("Viewer"));
*/
}

@{
	ViewBag.AllowFullScreen = true;
}

@section css{
	@Styles.Render("~/bundles/css/smarly-page")
	@Styles.Render("~/bundles/css/yandex-donate")
	@Styles.Render("~/bundles/css/partner")
	@if (ViewBag.IsAllowEdit)
	{
		@Styles.Render("~/bundles/css/markitup")
		@Styles.Render("~/bundles/css/smarly.admin")
	}
}


@section script
{
	<script type="text/javascript">
		jQuery(function($) {
			$('.main-content a').not('[href^="#"]').not('[href^="/"]').attr('target', '_blank');
		});
	</script>
	
	@if (!ViewBag.ShowContent)
	{
		@Scripts.Render("~/bundles/js/smarly.content.view")
		<script type="text/javascript">
			jQuery(function($) {
				$.smarlyContentView({ content: '#main-content', viewContent: '#view-content', socialPostUrl: '@Url.Action("Index", "SocialPost")' });
			})
		</script>
	}

	@if (!ViewBag.IsAllowEdit)
	{
		@Scripts.Render("~/bundles/js/smarly.adsense")
		@Scripts.Render("~/bundles/js/smarly.content")
		<script type="text/javascript">
			jQuery(function ($) {
				$.SmarlyAdsense.show();
				$('.main-content').smarlyContent();
			})
		</script>
	}

	@Styles.Render("~/bundles/css/highlight")
	@Scripts.Render("~/bundles/js/highlight")
	<script type="text/javascript">
		$(function() {
			hljs.tabReplace = '  ';
			hljs.lineNodes = true;
			hljs.initHighlightingOnLoad(true);
		});
	</script>

	@if (ViewBag.IsAdmin)
	{

		@Scripts.Render("~/bundles/js/admin/smarly.page")
		<script type="text/javascript">
			$().ready(function() {
				$.SmarlyAdminPage({
					current: '@Model.Url',
					deleteUrl: '@Url.Action("DeletePart", "Book", new {area = "Admin"})',
					publishStatusChangeUrl: '@Url.Action("ChangePublishStatus", "Book", new {area = "Admin"})'
				});
			});
		</script>
	}

	@if (ViewBag.IsAllowEdit)
	{
		@Scripts.Render("~/bundles/js/markitup")
		@Scripts.Render("~/bundles/js/admin/smarly.page.content")
		<script type="text/javascript">
			$().ready(function() {
				$.SmarlyAdminPageContent({
					EditContentUrl: '@Url.Action("Index", "EditContext", new {area = "admin"})',
					CurrentUrl: '@Model.Url',
					BookHashTag: '@Model.Book.Root.HashTag'
				});
			});
		</script>
	}
}

@section modal{
<div id="modal-purchase-pdf" class="modal hide" data-backdrop="static">
	@*
<div class="modal-header">
	<div data-toggle="buttons-checkbox" class="btn-group">
		<button id="account-logon" class="btn active" type="button">Вход1</button>
		<button id="account-create" class="btn" type="button">Регистрация</button>
		<button id="account-repair" class="btn" type="button">Востановление</button>
	</div>
</div>
<div class="account-logon">@Html.Partial("_AccountLogonDialog", new Smarly.Bussines.Model.Account.Login())</div>
<div class="account-create hide">@Html.Partial("_AccountCreateDialog", new Smarly.Bussines.Model.Account.NewAccount())</div>
<div class="account-repair hide">@Html.Partial("_AccountUpdateDialog", new Smarly.Bussines.Model.Account.UpdatePassword())</div>
*@
	
	<div class="modal-header">
		<h3 style="margin-top: 10px;">Pdf версия</h3>
	</div>
	<div class="modal-body">
		<p>bla bla bla</p>
		<p>bla bla bla</p>
	</div>

	<div class="modal-footer">
		<button class="btn" type="submit"><i class="icon-ok icon-white"></i>&nbsp;Войти</button>
		<button class="btn" data-dismiss="modal"><i class="icon-remove"></i>&nbsp;Отмена</button>
	</div>
</div>		
}

@{
	ViewBag.Title = Model.Text + " | " + Model.Book.Root.Text;
	ViewBag.Cover = Model.Book.CoverUrl;
	ViewBag.Description = "Онлайн книга " + Model.Book.Root.Text + " бесплатно на smarly.net";
		//	string keywords = headers.Aggregate(string.Empty, (current, h) => current + (h.Title + ", ")).TrimEnd(',', ' ');

		/*
		//	ViewBag.Keywords = keywords;

		*/

}

<div class="span3">
	@Html.Partial("_TextLeftNavigationPartial", Model)
</div>



<div class="span9">
	@Html.Partial("_TextPartial", Model)
</div>

@if (ViewBag.IsAdmin)
{
	@Html.Partial("_NewPartDialog", new BookTree());
}


		 
	

